package top.songxs.yygh.hosp.msm.listener;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import top.songxs.mq.consts.MqConst;
import top.songxs.yygh.hosp.msm.service.MsmService;
import top.songxs.yygh.vo.msm.MsmVo;

@Component
public class ListenerMSMQueue {
    @Autowired
    MsmService msmService;

    @RabbitListener(
            bindings = {
                    @QueueBinding(
                            value = @Queue(durable = "true", name = MqConst.QUEUE_MSM_ITEM),
                            exchange = @Exchange(name = MqConst.EXCHANGE_DIRECT_MSM, type = "direct"),
                            key = {MqConst.ROUTING_MSM_ITEM}
                    )
            }
    )
    public void listener(MsmVo msmVo) {
        String phone = msmVo.getPhone();
        Object message = msmVo.getParam().get("message");
        System.out.println(phone+"===="+message);

    }


}



